﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Library.Web.Infrastructure;
using Library.Web.Data;

namespace Library.Web.ViewModels
{
    public class BookDetailsViewModel : BaseViewModel
    {
        public Book Book { get; private set; }
        public PagedList<Data.BookComment> BookComments { get; private set; }

        public BookDetailsViewModel()
        {

        }

        /// <summary>
        /// Set book comments paged
        /// </summary>
        /// <param name="bookId"></param>
        /// <param name="pageNumber"></param>
        public void GetBookComments(int bookId, int pageNumber)
        {
            Book = Repository.GetBook(bookId);
            BookComments = new PagedList<BookComment>(Repository.BookComments(bookId), pageNumber);
        }
    }
}